# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: mexus <gilaldpellaeon@gmail.com>
pkgname=dua-cli
pkgver=2.20.3
pkgrel=1
pkgdesc="A tool to conveniently learn about the disk usage of directories, fast!"
arch=('loong64' 'x86_64')
url="https://github.com/Byron/dua-cli"
license=('MIT')
depends=('gcc-libs')
makedepends=('rust')
source=("$pkgname-$pkgver.tar.gz::https://github.com/Byron/${pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('b592d3a80e703ef9a31eb541cdab2de1f393f1959384f1c126907c729882d0387cc0ac841fc10df78831ba170058351256ee97cfb521a273f693122c490f3cdd')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  find -name Cargo.lock -exec rm -f {} \;
  mkdir -p .cargo
  cat > .cargo/config.toml <<EOF
[source.crates-io]
registry = "https://gitee.com/yetist/crates.io-index"
EOF
  cargo build --release
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  install -Dm 644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm 755 "target/release/dua" "$pkgdir/usr/bin/dua"
}
